package com.xianbeiying.app.ckgl.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.xianbeiying.app.ckgl.R;
import com.xianbeiying.app.ckgl.bean.EZqBean;
import com.xianbeiying.app.ckgl.util.LogUtils;

import java.util.List;

/**
 * 设备周期数据
 */
public class EquipmentGridViewAdapter extends BaseAdapter {
    private Context context;
    private List<EZqBean.PlantZqBean> zqBean;
    public EquipmentGridViewAdapter(Context context, List<EZqBean.PlantZqBean> zqBean) {
        this.context = context;
        this.zqBean = zqBean;
    }

    @Override
    public int getCount() {
        return zqBean.size();
    }

    @Override
    public Object getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_va_choice, parent, false);
            holder = new ViewHolder();
            holder.va_choice_number = (TextView) convertView.findViewById(R.id.va_choice_number);
            holder.tv_cp_type = (TextView) convertView.findViewById(R.id.tv_cp_type);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.tv_cp_type.setText(zqBean.get(position).getDevName());
        LogUtils.e("==================",zqBean.get(position).getDevName());
        return convertView;
    }

    private class ViewHolder {
        TextView va_choice_number;
        TextView tv_cp_type;
    }
}
